/**
 * This file is part of the dspace-poltman project http://www.poltman.com.
 *
 * This is free software; you can redistribute it and/or modify it under
 * the terms of DuraSpace DSpace license detailed in the LICENSE and NOTICE 
 * files at the root of the source tree and available online at
 * http://www.dspace.org/license/
 * 
 */
package com.poltman.dscentral.epeople;

import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zkplus.spring.SpringUtil;
import org.zkoss.zul.Listbox;

import com.poltman.dscentral.core.CoreSessionData;




/**
 * 
 * @author Zbigniew Ciok; z.ciok@poltman.com
 * @version $Revision: 1670 $
 *
 */
@SuppressWarnings("rawtypes")
public class AddEPeopleMenuGroupsController extends GenericForwardComposer {


	private static final long serialVersionUID = -6601690657199944716L;
	

	private static Logger log = Logger.getLogger(AddEPeopleMenuGroupsController.class);
	
	private Listbox sourceShortcutsListbox;
	private Listbox targetShortcutsListbox;

	
	@SuppressWarnings("unchecked")
	@Override
    public void doAfterCompose(org.zkoss.zk.ui.Component comp) throws Exception {
    	super.doAfterCompose(comp);

    }	
	
	/**
	 * Clears and reloads menu items
	 * @param items
	 */
	public void onClick$resetItemsBtn() throws Exception {
		//clears target items 
		List<Component> targetShortcuts = this.targetShortcutsListbox.getChildren();
		targetShortcuts.clear();
		
		//loads source itmes
		AddEPeopleMenuGroupsVM model = new AddEPeopleMenuGroupsVM();
		this.sourceShortcutsListbox.setModel(model.getSourceShortcuts());
		
		CoreSessionData coreSessionData = (CoreSessionData) SpringUtil.getBean("coreSessionData");
		coreSessionData.setAttribute("userMenuShortcuts", new ArrayList<String>());
		
	}
}
